package com.example.module_orders.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_orders.R
import com.yuwei.http.entity.ordersEntityItem

class OrdersAdapter : BaseQuickAdapter<ordersEntityItem,BaseViewHolder>(R.layout.orders_item){
    override fun convert(holder: BaseViewHolder, item: ordersEntityItem) {
        if (item.processingStatus == "处理中"){
            holder.setText(R.id.orders_item_title,"工单号: "+item.orderNumber)
            holder.setText(R.id.orders_item_type,item.processingStatus)
                .setTextColor(R.id.orders_item_type,Color.parseColor("#489EE9"))
                .setBackgroundResource(R.id.orders_item_type, R.drawable.orders_item_bg_type1)
            holder.setText(R.id.orders_item_time,"报修时间: "+item.repairTime)
            holder.setText(R.id.order_item_name,"报修人: "+item.repairName)
            holder.setText(R.id.orders_item_phone,"联系电话: "+item.contactMethod)
            holder.setText(R.id.orders_item_wz,"位置: "+item.repairLocation)
            holder.setText(R.id.orders_item_ms,item.faultDescription)
        }
        if (item.processingStatus == "待处理"){
            holder.setText(R.id.orders_item_title,"工单号: "+item.orderNumber)
            holder.setText(R.id.orders_item_type,item.processingStatus)
                .setTextColor(R.id.orders_item_type,Color.parseColor("#F8A955"))
                .setBackgroundResource(R.id.orders_item_type, R.drawable.orders_item_bg_type2)
            holder.setText(R.id.orders_item_time,"报修时间: "+item.repairTime)
            holder.setText(R.id.order_item_name,"报修人: "+item.repairName)
            holder.setText(R.id.orders_item_phone,"联系电话: "+item.contactMethod)
            holder.setText(R.id.orders_item_wz,"位置: "+item.repairLocation)
            holder.setText(R.id.orders_item_ms,item.faultDescription)
        }
        if (item.processingStatus == "已完成"){
            holder.setText(R.id.orders_item_title,"工单号: "+item.orderNumber)
            holder.setText(R.id.orders_item_type,item.processingStatus)
                .setTextColor(R.id.orders_item_type,Color.parseColor("#89C38B"))
                .setBackgroundResource(R.id.orders_item_type, R.drawable.orders_item_bg_type3)
            holder.setText(R.id.orders_item_time,"报修时间: "+item.repairTime)
            holder.setText(R.id.order_item_name,"报修人: "+item.repairName)
            holder.setText(R.id.orders_item_phone,"联系电话: "+item.contactMethod)
            holder.setText(R.id.orders_item_wz,"位置: "+item.repairLocation)
            holder.setText(R.id.orders_item_ms,item.faultDescription)
        }
    }
}